package jnpf.model.ragFlow.talkAssistant;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.List;

@Data
public class ChatCreateReq {
    @NotBlank(message = "name不能为空")
    @ApiModelProperty(value = "聊天助手的名称", required = true)
    private String name;

    @ApiModelProperty(value = "头像的Base64编码")
    private String avatar;

    @ApiModelProperty(value = "关联数据集的ID")
    private List<String> dataset_ids;

    @ApiModelProperty(value = "LLM设置")
    private LlmConfig llm;

    @ApiModelProperty(value = "提示设置")
    private PromptConfig prompt;

    @Data
    public static class LlmConfig {
        @ApiModelProperty(value = "模型名称")
        private String model_name;

        @ApiModelProperty(value = "温度参数")
        private Float temperature = 0.1f;

        @ApiModelProperty(value = "top_p参数")
        private Float top_p = 0.3f;

        @ApiModelProperty(value = "存在惩罚")
        private Float presence_penalty = 0.4f;

        @ApiModelProperty(value = "频率惩罚")
        private Float frequency_penalty = 0.7f;
    }

    @Data
    public static class PromptConfig {
        @ApiModelProperty(value = "相似度阈值")
        private Float similarity_threshold = 0.2f;

        @ApiModelProperty(value = "关键词相似度权重")
        private Float keywords_similarity_weight = 0.7f;

        @ApiModelProperty(value = "返回的top_n数量")
        private Integer top_n = 6;

        @ApiModelProperty(value = "变量列表")
        private List<Variable> variables;

        @ApiModelProperty(value = "重新排序模型")
        private String rerank_model;

        @ApiModelProperty(value = "top_k参数")
        private Integer top_k = 1024;

        @ApiModelProperty(value = "空响应内容")
        private String empty_response;

        @ApiModelProperty(value = "开场问候语")
        private String opener = "Hi! I am your assistant, can I help you?";

        @ApiModelProperty(value = "是否显示引用")
        private Boolean show_quote = true;

        @ApiModelProperty(value = "提示内容")
        private String prompt;
    }

    @Data
    public static class Variable {
        @ApiModelProperty(value = "变量key")
        private String key;

        @ApiModelProperty(value = "是否可选")
        private Boolean optional;
    }
}
